﻿<UserControl x:Class="Microsoft.Telco.Controls.WindowsPhone.CountryPicker"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             FontFamily="{StaticResource PhoneFontFamilyNormal}"
             FontSize="{StaticResource PhoneFontSizeNormal}"
             Foreground="{StaticResource PhoneForegroundBrush}"
             d:DesignHeight="480"
             d:DesignWidth="480">

    <Grid x:Name="LayoutRoot">
        <Border
            BorderBrush="#FFC2BCBC"
            x:Name="bdrCountryPicker"
            BorderThickness="1"
            HorizontalAlignment="Left"
            MouseLeftButtonDown="bdrCountryPicker_MouseLeftButtonDown"
            VerticalAlignment="Top">
            <Border.Background>
                <LinearGradientBrush
                    EndPoint="0.5,1"
                    StartPoint="0.5,0">
                    <GradientStop
                        Color="#FFCFCFCF"
                        Offset="0.671" />
                    <GradientStop
                        Color="White"
                        Offset="0.292" />
                    <GradientStop
                        Color="#FFFBFBFB"
                        Offset="0.465" />
                </LinearGradientBrush>
            </Border.Background>
            <StackPanel
                Orientation="Horizontal">
                <Image
                    x:Name="countryImage"
                    Margin="2"></Image>
                <Path
                    Data="M44.395828,0 L44.395828,30.112816"
                    Fill="#FFCCCCCC"
                    HorizontalAlignment="Right"
                    Stretch="Fill"
                    Stroke="#FFDFDFDF"
                    UseLayoutRounding="False"
                    Width="1">
                   
                </Path>
                <Path
                    Data="M212.91145,48.984737 L218.16191,48.984749 L215.66211,51.976151 z"
                    Height="4"
                    Stretch="Fill"
                    Width="8"
                    HorizontalAlignment="Center"
                    UseLayoutRounding="False"
                    VerticalAlignment="Center"
                    Margin="2,0,0,0">
                   
                    <Path.Fill>
                        <LinearGradientBrush
                            EndPoint="0.854,0.854"
                            StartPoint="0.146,0.146">
                            <GradientStop
                                Color="#FF525252"
                                Offset="1" />
                            <GradientStop
                                Color="#FF676565" />
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
            </StackPanel>
        </Border>
        <Popup x:Name="popupCountries">
            <Border Background="#FFE5E5E5"
                    CornerRadius="3"
                    Padding="5">
                <ItemsControl x:Name="listCountries"
                              HorizontalAlignment="Left"
                              VerticalAlignment="Center"
                              Height="300"
                              Width="270">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <VirtualizingStackPanel />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.Template>
                        <ControlTemplate>
                            <ScrollViewer>
                                <ItemsPresenter />
                            </ScrollViewer>
                        </ControlTemplate>
                    </ItemsControl.Template>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Grid HorizontalAlignment="Stretch"
                                  MouseLeftButtonUp="Grid_MouseLeftButtonUp">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="*" />
                                    <ColumnDefinition Width="Auto" />
                                </Grid.ColumnDefinitions>
                                <Image Grid.Column="0"
                                       HorizontalAlignment="Left"
                                       Source="{Binding ImageUrl}"
                                       Stretch="Fill"
                                       VerticalAlignment="Center" />
                                <TextBlock Grid.Column="1"
                                           TextWrapping="Wrap"
                                           Text="{Binding Name}"
                                           VerticalAlignment="Center"
                                           FontFamily="Arial"
                                           Foreground="Black"
                                           FontSize="15"
                                           Margin="5,0,0,0"></TextBlock>
                                <TextBlock Grid.Column="2"
                                           TextWrapping="Wrap"
                                           Text="{Binding Code}"
                                           FontFamily="Arial"
                                           Foreground="Black"
                                           FontSize="15"
                                           VerticalAlignment="Center" />
                            </Grid>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </Border>
        </Popup>
    </Grid>
</UserControl>